class DiscardsController < ApplicationController
  # GET /discards
  # GET /discards.xml
  def index
    @discards = Discard.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @discards }
    end
  end

  # GET /discards/1
  # GET /discards/1.xml
  def show
    @discard = Discard.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @discard }
    end
  end

  # GET /discards/new
  # GET /discards/new.xml
  def new
    @discard = Discard.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @discard }
    end
  end

  # GET /discards/1/edit
  def edit
    @discard = Discard.find(params[:id])
  end

  # POST /discards
  # POST /discards.xml
  def create
    @discard = Discard.new(params[:discard])

    respond_to do |format|
      if @discard.save
        format.html { redirect_to(@discard, :notice => 'Discard was successfully created.') }
        format.xml  { render :xml => @discard, :status => :created, :location => @discard }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @discard.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /discards/1
  # PUT /discards/1.xml
  def update
    @discard = Discard.find(params[:id])

    respond_to do |format|
      if @discard.update_attributes(params[:discard])
        format.html { redirect_to(@discard, :notice => 'Discard was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @discard.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /discards/1
  # DELETE /discards/1.xml
  def destroy
    @discard = Discard.find(params[:id])
    @discard.destroy

    respond_to do |format|
      format.html { redirect_to(discards_url) }
      format.xml  { head :ok }
    end
  end
end
